This description relates to managing lock and unlock operations using operation prediction.
A ‘lock’ is a mechanism that is available in various computing environments for enforcing a mutual exclusion (sometimes called ‘mutex’) policy. Such a policy may be part of a concurrency control scheme, for example. A lock can be used by a processing entity that is executing on a processor (or on a core of a multi-core processor), such as a thread within a multi-threaded computing environment. One example of a situation in which a lock may be used is when different threads may be able to access the same ‘critical section’ (or ‘critical region’) of a program associated with a shared resource, such as a data structure, network connection, or device interface. In order to avoid contention, each thread may be required to acquire a lock associated with a critical section (by performing a lock operation) before accessing that critical section, and then each thread would release the lock (by performing an unlock operation) after its access has been completed. Locks can also be used for other types of mutual exclusion.
One form of standardization for managing threads is an execution model called Portable Operating System Interface (POSIX) Threads (or ‘pthreads’), which defines a library of various operations including lock and unlock operations for use in mutual exclusion, such as when accessing a critical section of a program. Some processor architectures provide hardware support for certain aspects of various execution models, such as operations in the pthread library.